package com.dalanmao.adapter;

import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;


/**
 * 
 * @author dalanmao
 *
 * @param <T>	数据源类型
 */
public abstract class CommonAdapter<T> extends BaseAdapter {
	
	
	/**
	 * 数据源
	 */
	public List<T> mData;
	/**
	 * 上下文
	 */
	public Context mContext;
	/**
	 * 布局填充器
	 */
	public LayoutInflater mLInflater;
	
	public CommonAdapter(){}

	/**
	 * 适配器
	 * @param mContext
	 * @param mData
	 */
	public CommonAdapter(Context mContext, List<T> mData) {
		this.mContext = mContext;
		this.mData = mData;
		mLInflater = LayoutInflater.from(mContext);
	}
	
	

	@Override
	public int getCount() {
		return mData.size();
	}

	@Override
	public Object getItem(int position) {
		return mData.get(position);
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	public abstract View getView(int position, View convertView, ViewGroup parent);
	

}
